package com.qh.pay.dao;

import com.qh.pay.api.Order;
import org.apache.ibatis.annotations.*;

/**
 * 掉单
 *
 * @date 2018-01-02 10:21:06
 */
@Mapper
public interface PayOrderQrDao {

    @Select("select `order_no`,`mobile`,`amount`,`business_no`,`title`,`out_channel`,`memo`,crt_date,`product`" +
            " from pay_order_qr where order_no = #{orderNo} and mobile = #{mobile}")
    Order get(@Param("orderNo") String orderNo, @Param("mobile") String mobile);

    @Select("select `order_no`,`mobile`,`amount`,`business_no`,`title`,`out_channel`,`memo`,crt_date,`product`"
            + " from pay_order_qr where business_no = #{businessNo}")
    Order getByBusinessNo(@Param("businessNo") String businessNo);

    @Insert("insert into pay_order_qr(`order_no`,`mobile`,`amount`,`business_no`,`title`,`out_channel`," +
            "`memo`,crt_date,product)"
            + "values(#{orderNo},#{mobile},#{amount},#{businessNo},#{title},#{outChannel},#{memo},#{crtDate}," +
            "#{product})")
    int save(Order order);

    @Update("update pay_order_qr set order_no = #{orderNo} where " +
            "business_no = #{businessNo} ")
    int update(Order order);
}
